package com.itheima.health.controller;

import com.itheima.health.common.MessageConst;
import com.itheima.health.entity.Result;
import com.itheima.health.entity.ValidateCode;
import com.itheima.health.util.Code2RedisUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author ：李帅
 * @date ：Created in 2022年06月07日
 * @description ：
 * @version: 1.0
 */
@Slf4j
@RestController
@RequestMapping("/mobile/validateCode")
public class ValidateCodeController {

    @Autowired
    private Code2RedisUtils code2RedisUtils;

    @PostMapping("/send")
    //http://localhost:17080/mobile/validateCode/send?type=MOBILE_SIGNIN&telephone=17633534339
    public Result sendMsg(ValidateCode validateCode){
        String code = code2RedisUtils.addRedis(validateCode);
        return new Result(true,MessageConst.SEND_VALIDATECODE_SUCCESS);
    }

}
